﻿namespace Digitalmes.Application.Mes;

public sealed class ProdTransSnRecordDto : Dto
{
    /// <summary>
    /// SN
    /// </summary>
    public string? Sn { get; set; }

    /// <summary>
    /// 产品 Id
    /// </summary>
    public long ProductId { get; set; }

    /// <summary>
    /// 产品代码
    /// </summary>
    public string? ProductCode { get; set; }

    /// <summary>
    /// 工单号，没有则为空。
    /// </summary>
    public string? Wo { get; set; }

    /// <summary>
    /// 产线 Id。
    /// </summary>
    public long LineId { get; set; }

    /// <summary>
    /// 产线编号
    /// </summary>
    public string? LineCode { get; set; }

    /// <summary>
    /// 工位 Id。
    /// </summary>
    public long OpId { get; set; }

    /// <summary>
    /// 工位编号
    /// </summary>
    public string? OpCode { get; set; }

    /// <summary>
    /// 工序 Id。没有则为 0。
    /// </summary>
    public long ProcId { get; set; }

    /// <summary>
    /// 工序编号。没有则为空。
    /// </summary>
    public string? ProcCode { get; set; }

    /// <summary>
    /// 当前所在的工艺路线 Id。没有则为 0。
    /// </summary>
    /// <remarks>线外站时设置为 0。</remarks>
    public long RoutingId { get; set; }

    /// <summary>
    /// 当前所在的工艺路线编号。
    /// </summary>
    /// <remarks>线外站产品，可设置为空。</remarks>
    public string? RoutingCode { get; set; }

    /// <summary>
    /// 产品在当前工位进站时间
    /// </summary>
    public DateTime InboundTime { get; set; }

    /// <summary>
    /// 产品在当前工位出站时间
    /// </summary>
    public DateTime OutboundTime { get; set; }

    /// <summary>
    /// 用时(秒)
    /// </summary>
    public double CycleTime { get; set; }

    /// <summary>
    /// 标准工作工时(秒)，为 0 时不做计算。
    /// </summary>
    public double StdWorkDuration { get; set; }

    /// <summary>
    /// 班次
    /// </summary>
    public string? Shift { get; set; }

    /// <summary>
    /// 操作人员
    /// </summary>
    public string? Operator { get; set; }

    /// <summary>
    /// 产品当前过站结果（OK/NG）
    /// </summary>
    public PassResultEnum PassResult { get; set; }

    public string PassResultDesc => PassResult.Description();

    /// <summary>
    /// NG 步序号。
    /// </summary>
    /// <remarks>若该工序有设置步序，可在 NG 时对应的步序，没有则为空。</remarks>
    public List<int>? NgSteps { get; set; }

    /// <summary>
    /// 流程标识
    /// </summary>
    public FlowTypeEnum FlowType { get; set; }

    public string FlowTypeDesc => FlowType.Description();

    /// <summary>
    /// 返工单据。在产品在当前工位是返工时，设置该返工单据。
    /// </summary>
    public string? ReworkDoc { get; set; }

    /// <summary>
    /// 客户SN
    /// </summary>
    public string? CustomerSn { get; set; }

    /// <summary>
    /// 数据版本。
    /// </summary>
    /// <remarks>用于数据关联</remarks>
    public long Version { get; set; }
}
